﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace leviathan.puzzle
{
    public partial class Puzzle : Form
    {
        private PuzzleClass puzzleengine;
        private supervisor.Supervisor super;

        public Puzzle(string type, supervisor.Supervisor supv)
        {
            InitializeComponent();

            puzzleengine = new PuzzleClass(type, this);
            super = supv;

            this.Show();
        }

        private void Puzzle_Load(object sender, EventArgs e)
        {
            this.Visible = true;
            this.Activate();
            this.BringToFront();

            output.Text = puzzleengine.getDesc();
        }

        private void Puzzle_FormClosing(object sender, FormClosingEventArgs e)
        {
            super.setSearchState(puzzleengine.getState());
            super.search(puzzleengine.getXp());
        }

        private void button1_Click(object sender, EventArgs e)
        {
            puzzleengine.answerTry(input.Text);
            output.Text = puzzleengine.getDesc();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            puzzleengine.idk();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            puzzleengine.needHelp(ref output);
        }
    }
}
